
/////////////////////////////////////////////////////////////////////////////////////////
//
// Licensed is under the "New" BSD License.
//		License page - https://code.google.com/p/motioncodelibrary/wiki/LICENSE
//
// MotionCodeLibrary collection - https://code.google.com/p/motioncodelibrary/
//
// Author Sergey Solohin (Neill3d) 2014
//  e-mail to: s@neill3d.com
//		www.neill3d.com
/////////////////////////////////////////////////////////////////////////////////////////

#pragma once

class ProgressHandler
{
public:
	ProgressHandler(char *caption, char *info, int numberOfTasks=100)
		: mCurrent(0)
		, mCount(numberOfTasks)
	{
		mProgress.Caption = caption;
		mProgress.Text = info;
		mProgress.Percent = 0;
	};

	void NextTask( char *info=NULL )
	{
		if (info) mProgress.Text = info;
		mCurrent++;
		Update();
	}

	void Update()
	{
		double value = 100.0 * mCurrent / mCount;
		mProgress.Percent = (int) value;
	}

private:
	int			mCurrent;	// index of current task
	int			mCount;		// number of all tasks

	FBProgress	mProgress;
};
